<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>保单审核</title>
    <link rel="stylesheet" href="../static/layui1/css/layui.css">
    <script src="../static/layui/css/layui.css"></script>
    <style>
        html,body{
            background: url("../static/img/img10.jpg");
            background-repeat: no-repeat;
            background-size: 100% 100%;
            background-attachment: fixed;
        }
        .box3{


        margin-left: 400px;
        margin-top: 100px;
        bottom: 0;

        /*border :solid     1px  black;*/
        width: 40%;
        height: 600px;
        /*background-color:white;*/
        /*background-image: linear-gradient(to top,#3a90db ,#ddd);*/

    }
        th,td {

            height: 40px;

            line-height: 25px;

            text-align: center;

            border: 1px solid #ccc;

        }

        th {

            background: #eee;

            font-weight: normal;

        }
        tr {

            background: #fff;

        }

        tr:hover {

            background: #cc0;

        }
    </style>

</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">

        <div class="layui-logo layui-hide-xs layui-bg-black" >智能车险投保系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->

        <ul class="layui-nav layui-layout-left">

            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

        </ul>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="../static/img/wangjianfei.jpg" class="layui-nav-img">
                    管理员
                </a>
                <dl class="layui-nav-child">

                    <dd><a th:href="@{login}">退出登录</a></dd>

                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item ">
                    <a href="javascript:;">保单管理</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{toubaodan}">保单审核</a></dd>

                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a th:href="@{addbasiscarinfo}">添加车辆基础信息</a></dd>
                        <dd><a th:href="@{addinsurance}">添加险种</a></dd>
                    </dl>
                </li>



            </ul>
        </div>
    </div>
    <div class="box3">
        <table align="center">
            <h2 align="center">保单审核</h2>
            <tr>
                <th>序号</th>
                <th>投保人姓名</th>
                <th>被保人姓名</th>
                <th>车名</th>
                <th>唯一保单号</th>
                <th>审核状态</th>
                <th>审核原因</th>
                <th colspan="2">操作</th>
            </tr>

            <tr th:each="toubaodans,toubaodansStat:${toubaodaninfo}">
                <td th:text="${toubaodansStat.count}"></td>
                <td th:text="${toubaodans.uname}"></td>
                <td th:text="${toubaodans.bname}"></td>
                <td th:text="${toubaodans.carname}"></td>
                <td th:text="${toubaodans.policyid}"></td>
                <td th:text="${toubaodans.states}"></td>
                <td th:text="${toubaodans.bec}"></td>
                <td><button class="qbtn" th:data-id="${toubaodans.id}" >通过</button></td>
                <td><button class="bbtn" th:data-id="${toubaodans.id}">不通过</button></td>
            </tr>

        </table>
    </div>
</div>


<script src="../static/js/jquery.min.js">
</script>
    <script src="../static/layui/layui.js"></script>

<script type="text/javascript">
    $(document).on('click','.qbtn',function () {
        var param={"id":$(this).data("id")};
        // console.log(param)
        $.ajax({
            url:"/update1",
            type:'post',
            data:param,
            dataType:'json',
            success:function (data){
                if(data==1){
                    alert('审核成功');
                    location.href="/toubaodan";
                }else {
                    alert('重复');
                }
            },
            error:function(xhr) {
                console.error(xhr.responseText);
            }
        });
    })

    $(document).on('click','.bbtn', function(){
        var param={"id":$(this).data("id")};
        console.log(param);
        $.ajax({
            url:"/querytoubaodan",
            type:'post',
            data:param,
            dataType:'json',
            success:function (data){
                window.data=data;
                layer.open({
                    type: 2,
                    title: '审核结果',
                    maxmin: true,
                    shadeClose: true, //点击遮罩关闭层
                    area : ['600px' , '320px'],
                    content: '/aa'
                });
            },
            error:function(xhr) {
                console.error(xhr.responseText);
            }
        });



    });
</script>


</body>
</html>